import java.awt.*;

import javax.swing.*;

public class FinishNode extends Element {
	
	public FinishNode(int x, int y, GridPanel parent) {
		super("", x, y, parent);
		statHeight = 20;
		statWidth = 20;
		maxWidth = statWidth;
		maxHeight = statHeight;
		setSize(statWidth, statHeight);
		this.width = statWidth;
		this.height = statHeight;
		this.maxInputCount = 1;
		this.maxOutputCount = 0;
		
	}

	public void paintComponent(Graphics g) {

		int gap = 4;
		int innerOvalWidth = width - gap;
		int innerOvalHeight = height - gap;
		Graphics2D g2d = (Graphics2D) g;
		g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
				RenderingHints.VALUE_ANTIALIAS_ON);
		g2d.setColor(Color.WHITE);
		g2d.fillOval(0, 0, width, height);
		g2d.setColor(Color.BLACK);
		g2d.drawOval(0, 0, width-1, height-1);
		g2d.fillOval((width-innerOvalWidth)/2, (height-innerOvalHeight)/2, innerOvalWidth, innerOvalHeight);
		
		if (selected) {
			g2d.setColor(Color.BLACK);
			int[] xP = new int[3];
			int[] yP = new int[3];
			xP[0] = width - 7;
			yP[0] = height;
			xP[1] = width;
			yP[1] = height - 7;
			xP[2] = width;
			yP[2] = height;
			g2d.fillPolygon(xP, yP, 3);
		}
	}
}